package com.example.mapper;

import com.example.entity.Goods;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface GoodsMapper {
    /**
     * 货品信息查询
     * @return
     */
    //@Select("select * from emp")
    public List<Goods> list(String name, Integer warehouseId);

    /**
     * 批量删除
     * @param ids
     */
    void delete(List<Integer> ids);

    /**
     * 新增员工
     * @param goods
     */
    @Insert("insert into mall_backend.commodity(pack_size, price, warehouse_id, name, inventory, create_time, update_time) " +
            "values (#{packSize},#{price},#{warehouseId},#{name},#{inventory},#{createTime},#{updateTime})")
    void insert(Goods goods);

    /**
     * 根据ID查询货品
     * @param id
     * @return
     */
    @Select("select * from mall_backend.commodity where id = #{id}")
    Goods getById(Integer id);

    /**
     * 更新货品
     * @param goods
     */
    void update(Goods goods);
}
